# -*- coding: utf-8 -*-
# author: AZJ
# date: 2024/11/14
# 假如命运扼住了你的咽喉，你就去挠她的咯吱窝
import pytest
from selenium import webdriver


# driver = webdriver.Chrome()
# web = webdriver.Edge()
@pytest.fixture(params=["Edge","Chrome"])
def page(request):
    return request.param
    # page = Page()
    # request.cls.page = page
    # yield page

@pytest.fixture()
def user(request):
    yield request.param

@pytest.fixture()
def environment(request):
    yield request.param

class TestPageClass:
    # @classmethod
    # def setup_class(cls):
    #     cls.page = Page()

    def test_page_open(self, page):
        # print(page)
        web = ""
        if page == "Edge":
            web = webdriver.Edge()
        if page == "Chrome":
            web = webdriver.Chrome()
        web.close()

    @pytest.mark.parametrize("user",[("admin", "admin123"),("guest", "guest123"),("user", "user123")], indirect=True)
    @pytest.mark.parametrize("environment", ["https://www.test.com","https://www.pre.com","https://www.online.com"], indirect=True)
    def test_login(self, user:tuple, environment):
        print(f"Logging {environment} {user[0]} with password {user[1]}")

if __name__ == '__main__':
    pytest.main()